#ifndef GESTURECLASSIFIER_HPP
#define GESTURECLASSIFIER_HPP

/*
 *  GeometricGestureClassifier.hpp
 *  
 *
 *  Created by Rasmus Kyng on 15/01/2011.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#include <cv.h>
#include <ml.h>
#include "abstractProbabilityTransformer.hpp"
#include <string>

class AbstractGestureClassifier {
public:
	virtual bool isHandActive( cv::Mat& handImg )=0;
	virtual ~AbstractGestureClassifier() {};
};

class MLGestureClassifier : public AbstractGestureClassifier {
public:
	static const cv::Size perSampleSize;
	
	MLGestureClassifier( string pcaName, cv::Ptr< AbstractProbabilityTransformer > probTransPtr );
	virtual ~MLGestureClassifier() {};
	virtual bool isHandActive( cv::Mat& handImg );
protected:
	cv::PCA pca;
	cv::Ptr< AbstractProbabilityTransformer > probTransPtr;
	
	cv::Mat getResizedImg( cv::Mat& handImg );
	virtual bool predict( cv::Mat& dataSampleForPrediction )=0;
	
	MLGestureClassifier( cv::Ptr< AbstractProbabilityTransformer > probTransPtr );//For use in derivative class (classificationDataLoader)
};

class BoostGestureClassifier : public MLGestureClassifier {
public:
	BoostGestureClassifier( const char* mlName, string pcaName, cv::Ptr< AbstractProbabilityTransformer > probTransPtr );
	//BoostGestureClassifier( string mlAndPcaName, cv::Ptr< AbstractProbabilityTransformer > probTransPtr ); //FOR WHEN NAMES ARE IDENTICAL
	virtual ~BoostGestureClassifier() {};
protected:
	CvBoost boost;
	cv::Mat missingMask; //This is only needed due to a bug in OpenCV which does not allow 
	
	virtual bool predict( cv::Mat& dataSampleForPrediction );
};

#endif